<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*  let p1 = new Promise((resolve, reject) => {
             let count = Math.floor(Math.random() * 10)

             setTimeout(() => {
                 console.log(count)
                 count % 2 === 0 ? resolve('success') : reject('fail')
             }, 0)
         })

         p1.then((res) => {
             console.log(res)
         }, (err) => {
             console.log(err)
         }) */


        /* let p2 = new Promise((resolve, reject) => {
            let count = Math.random() * 10
            setTimeout(() => {
                console.log(count)
                count > 5 ? resolve('success') : reject('fail')
            }, 0)
        }).then((res) => { console.log(res) })
            .catch((err) => { console.log('catch' + err) }) */

        /*  let p3 = new Promise((resolve, reject) => {
             let count = Math.floor(Math.random() * 10)
 
             setTimeout(() => {
                 console.log(count)
                 count % 2 === 0 ? resolve('success') : reject('fail')
             }, 0)
         })
 
         try {
             p3.then(res => {
                 console.log(res)
             })
         } catch (err) {
             console.log(err)
         }
 
         setTimeout(() => {
             console.log('2seconds')
         }, 2000) */
    </script>
</body>

</html>